<%@ page import="top.sjydzq.www.bean.User" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <link href="../css/before/daohang.css" rel="stylesheet" type="text/css" />
    <link href="../css/before/common.css" rel="stylesheet" type="text/css" />
    <link href="../css/before/style.css" rel="stylesheet" type="text/css" />
    <style>
        .header-bar {
            background: #bb1700;
        }
    </style>
</head>
<%
    User user = (User) session.getAttribute("user");

    int uid;
    if (user != null) {
        uid = user.getId();
    } else {
        uid = 0;
    }
%>
<body>
	<div class="all_zong">
		<!--最上面 灰色条部分-->
		<div class="all_zong_top">
			<div class="all_zong_top_right a8c">
				<table border="0" cellspacing="0" cellpadding="0" class="main_login">
					<tr>
						<% if (user == null) { %>
                            <td>
                                <p>
                                    <a href="/user/login" target="_top">登录</a>
                                </p>
                            </td>
                            <td><span class="xx">|</span></td>
                            <td>
                                <p>
                                    <a href="/user/register" target="_top">注册</a>
                                </p>
                            </td>
                        <% } else { %>
                            <td>
                                <a href="/user/userCenter?uid=<%= uid %>" target="_top"><%= user.getBemail() %></a>
                                <span class="xx">|</span>
                            </td>
                            <td>
                                <a href="/user/logout" target="_top">退出</a>
                            </td>
                        <% } %>
					</tr>
				</table>
			</div>
		</div>
		<!--end-->
		<!--logo 搜索-->
		<div class="all_zong_logo">
			<div class="all_zong_logo2">
				<img src="../images/before/mylogo.png" />
			</div>
			<div class="back_search">
				<div class="back_search_red">
					<form action="/search" name="myForm" method="post" target=_parent>
						<div class="div2">
							<input type="text" name="keyword" class="txt" placeholder="搜点什么..." />
						</div>
						<div class="div1">
							<input type="submit" class="an"  value="搜索" />
						</div>
					</form>
				</div>
			</div>
			<!--end-->
		</div>
		<!--红色 导航-->
		<div class="skin_a">
			<div>
				<div class="all_zong">
					<div class="header-bar front_daohang">
						<ul>
							<li><a href="/" target="_top">首页</a></li>
							<!-- 显示商品类型 -->
							<c:forEach items="${categories}" var="category">
								<li>
									<a href="/product/list?type=category&tid=${category.id}" target="_top">
										${category.typenameme}
									</a>
								</li>
							</c:forEach>
							<li class="buy">
								<p class="car">
									<a href="/cart/index?uid=<%= uid %>" target="_parent">购物车</a>
								</p>
							</li>
						</ul>
					</div>
				</div>
			</div>
		</div>
		<!--红色 导航 end-->
	</div>
</body>
</html>
